<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div></div>

<script>
    let d=document.querySelector("div");
//    修改元素的html内容
    d.innerHTML="<h1>我是h1</h1>";
    d.innerHTML+="<h2>我是h2</h2>"
//    得到body元素对象
    let body=document.querySelector("body");
    body.innerHTML+="<h3>我是h3</h3>";

    let arr=[
        {name:"悟空",age:800},
        {name:"八戒",age:1000},
        {name:"沙僧",age:900}
        ]
    //遍历数组
    for (let i = 0; i <arr.length ; i++) {
        let p =arr[i];
        body.innerHTML+="<h4>我叫"+p.name+"，今年"+p.age+"岁</h4>";
    }
</script>
</body>
</html>